package models

import (
	"CMETO/utils"
	"time"
)

// 账户表
type Account struct {
	// 账户Id
	Id int `json:"id" gorm:"column:id;type:int;auto_increment;primary_key;"`
	// 用户Id
	UserId int `json:"user_id" gorm:"column:user_id;type:int;"`
	// 账户余额
	Amount string `json:"amount" gorm:"column:amount;type:varchar(50);"`
	// 交易密码
	Password string `json:"password" gorm:"column:password;type:varchar(120);"`
	// 状态
	Status int `json:"status" gorm:"column:status;type:int;"`
	// 创建时间
	CreateTime string `json:"create_time" gorm:"column:create_time;type:varchar(30);"`
	// 是否删除
	IsDelete int `json:"is_delete" gorm:"column:is_delete;type:int;"`
}

// 插入一批账户数据
func InsertMockAccount() {
	DB.Model(&Account{}).Create([]Account{
		{Id: 1, UserId: 11, Amount: "100.00", Password: "44f7ccd48f7fd05d8d00cd0fb456e764360607a812f7c60353d2673053a64ee1", Status: 1, CreateTime: utils.TimeFormatter(time.Now()), IsDelete: 0},
		{Id: 2, UserId: 12, Amount: "100.00", Status: 1, Password: "44f7ccd48f7fd05d8d00cd0fb456e764360607a812f7c60353d2673053a64ee1", CreateTime: utils.TimeFormatter(time.Now()), IsDelete: 0},
	})
}
